package com.itheima.mArrayList;

import java.util.ArrayList;

public class ArrayListDemo02 {
    public static void main(String[] args) {
        ArrayList<Student> students = new ArrayList<>();
        Student sti1 = new Student("张三",5);
        Student stu2 = new Student("赵四",54);
        Student stu3 = new Student("刘能",55);
        students.add(sti1);
        students.add(stu2);
        students.add(2,stu3);
        for (int i = 0; i < students.size(); i++) {
            Student s = students.get(i);
            System.out.println("s.getAge() = " + s.getAge());
            System.out.println("s.getName() = " + s.getName());
        }
    }
}
